/*
 * @Description: 退票确认弹窗
 * @Author: ziwei.ma
 * @Date: 2019-10-22 15:52:30
 * @Last Modified by: tao.xie
 * @Last Modified time: 2019-11-01 03:06:23
 */
<template>
  <mask-module
    ref="mask"
    :isClickBgToHide="false"
  >
    <div class="dishonour_wrap">
      <div class="tips">确定提交退票申请吗？</div>
      <div class="btns flex-h flex-hsb">

        <button
          class="btn_font"
          @click="onConfirm"
        >确定</button>
        <button
          class="btn_font baseColorNoAcitve"
          @click="onCancle"
        >取消</button>
      </div>
    </div>

  </mask-module>
</template>
<script>
import AnimatedDialog from '@/components/animateddialog/AnimatedDialog'
import { getDishonour } from '../../api/api'
export default {
  components: {
    'mask-module': AnimatedDialog
  },
  props: {
    ticketDetail: {
      type: Object,
      default: null
    }
  },
  computed: {
    mask() {
      return this.$refs.mask
    }
  },
  data() {
    return {
      textareaValue: '',
      isClick: true
    }
  },
  methods: {
    onCancle() {
      this.mask.hide()
    },
    onConfirm() {
      if (this.isClick) {
        this.isClick = false
        getDishonour(this.ticketDetail.ticketTypeID).then(res => {
          this.mask.hide()
          console.warn(this.ticketDetail.ticketTypeID)
          if (this.ticketDetail.ticketType === 1) {
            this.$parent.getTicketDetailData()
          } else {
            this.$router.push('/record/index')
          }
        }).catch(err => {
          console.error(err)
        })
        setTimeout(() => {
          this.isclick = true
        }, 2000)
      } else {
        this.showToast('正在退款，请稍后')
      }
    }
  }
}
</script>
<style scoped>
.dishonour_wrap {
  position: absolute;
  width: 540px;
  height: 240px;
  background-color: #fff;
  border-radius: 16px;
  box-sizing: border-box;
}
.tips {
  height: 152px;
  text-align: center;
  line-height: 152px;
}
.btns {
  box-sizing: border-box;
  border-bottom-left-radius: 16px;
}
.btns > button {
  width: 50%;
  height: 86px;
  border: none;
  background: #fff;
}
.btns > button:nth-of-type(1) {
  border-top: 1px solid rgb(0, 0, 80, 0.05); /*no*/
  border-right: 1px solid rgb(0, 0, 80, 0.05); /*no*/
  border-bottom-left-radius: 16px;
}
.btns > button:nth-of-type(2) {
  border-top: 1px solid rgb(0, 0, 80, 0.05); /*no*/
  border-bottom-right-radius: 16px;
}
.btn_font {
  font-size: 18px; /*no*/
  line-height: 22px; /*no*/
}
</style>
